<!--
// +----------------------------------------------------------------------
// | Created by PHPstorm: JRKAdmin框架 [ JRKAdmin ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved.
// +----------------------------------------------------------------------
// | SiteUrl: http://www.luckyhhy.cn
// +----------------------------------------------------------------------
// | Author: LuckyHhy <jackhhy520@qq.com>
// +----------------------------------------------------------------------
// | Date: 2020/3/25-11:30
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------
*-->

{extend name='public/window' /}

{block name="content"}

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">

                <div class="layui-form-item">
                    <label class="layui-form-label">上级部门：</label>
                    <div class="layui-input-block">
                        <select name="pid" lay-search="">
                            <option value="0" {eq name="$pid" value="0"} selected {/eq}>顶级部门</option>
                            {volist name="tree" id="t"}
                            <option value="{$t.id}" {eq name="$pid" value="$t.id"} selected {/eq}>{$t.title_show}</option>
                            {/volist}
                        </select>

                    </div>
                </div>
                {:token()}

                {if isset($info['id'])}
                <input type="hidden" name="id" value="{$info.id}" >
                {/if}
                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">部门名称：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <input type="text" name="dname" value="" placeholder="请输入部门名称" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入部门名称" autocomplete="off" class="layui-input ">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">负责人：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <input type="text" name="charger" value="" placeholder="请输入部门负责人" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入负责人" autocomplete="off" class="layui-input ">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">是否启用：</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="radio" name="status" value="1" title="启用" lay-filter=""  checked>
                        <input type="radio" name="status" value="0" title="关闭" lay-filter="" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">编制人数：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <input type="number" name="pnum" value="" min="0"  max="1000" placeholder="请输入编制人数" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入编制人数" autocomplete="off" class="layui-input ">
                        <p class="help-block">部门预计编制人数</p>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">备注：</label>
                    <div class="layui-input-block input-custom-width" style="">
                        <textarea name="beizhu" placeholder="" lay-verify=""  autocomplete="off" class="layui-textarea "></textarea>
                    </div>
                </div>

                {:widget('common/forms/submit',array('add','立即提交',2))}

            </form>
        </div>
    </div>
</div>



<script>
    layui.use(['element', 'form', 'jquery','lucky'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky=layui.lucky;

        var info = {:json_encode($info)};
        form.val("form", info);
        form.render();

        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('addDepartment')}",data.field,"table_id",1);
            return false;
        });
    })
</script>

{/block}

